<ul class="layui-nav" lay-filter="mainmenu">
    @foreach($menudata as $item)
        @if(isset($item['sub']) && empty($item['sub']))
            @if(Entrust::can($item['slug']))
                <li class="layui-nav-item" data-pid="{{$item['code']}}">
                    <a href="javascript:;">
                        {{--<i class="yjs-icon">{{$item['iconfont']}}</i>--}}
                        <i class="yjs-icon">{!!$item['iconfont']!!}</i>
                        <cite>{{$item['name']}}</cite>
                        {{--<span class="layui-badge">9</span>--}}
                    </a>
                </li>
            @endif

        @else
            @if(Entrust::can($item['slug']))
                <li class="layui-nav-item">
                    <a href="javascript:;">
                        <i class="yjs-icon">{!!$item['iconfont']!!}</i>
                        <cite>{{$item['name']}}</cite>
                    </a>
                    <dl class="layui-nav-child">
                        @foreach($item['sub'] as $subitem)
                            @if(Entrust::can($item['slug']))
                                <dd data-pid="{{$subitem['code']}}">
                                    <a href="javascript:;">
                                        <i class="yjs-icon">{!!$subitem['iconfont']!!}</i>
                                        <cite>{{$subitem['name']}}</cite>
                                    </a>
                                </dd>
                            @endif
                        @endforeach
                    </dl>
                </li>
            @endif


        @endif
    @endforeach
</ul>